# Contributor: Martin Schmidt <martin.schmidt13@gmx.de>
# Maintainer: Martin Schmidt <martin.schmidt13@gmx.de>
_commit=2c3abf52824ad23a4caae7565ef158ef91767704
pkgname=mediastreamer2-plugin-openh264
pkgver=1.2.1_git20200309
pkgrel=0
pkgdesc="An H.264 encoder/decoder plugin for mediastreamer2 based on the openh264 library"
url="https://gitlab.linphone.org/BC/public/msopenh264"
arch="all"
license="GPL-2.0-or-later"
options="!check" # no test available
makedepends="cmake ortp-dev bctoolbox-dev mediastreamer2-dev openh264-dev"

source="$pkgname-$_commit.tar.gz::https://gitlab.linphone.org/BC/public/msopenh264/-/archive/$_commit.tar.gz
"

builddir="$srcdir/msopenh264-$_commit"

prepare() {
	default_prepare
	sed -i 's/ORTP\ REQUIRED/ortp\ REQUIRED/g' src/CMakeLists.txt
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake \
		-DCMAKE_SKIP_INSTALL_RPATH=ON \
		-DENABLE_STRICT=NO \
		-DENABLE_SHARED=YES

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="7a62edd688a1336aee8f30d72b8e8d5bee62e68e02a23cfc4c043af07e8f231a247ce5a817538abe6f61956cb11567752b15228b57ef3f67a5125789328d3897  mediastreamer2-plugin-openh264-2c3abf52824ad23a4caae7565ef158ef91767704.tar.gz"
